//
//  CAnAlgSleep+Desc.m
//  CareRing
//
//  Created  on 2024/12/14.
//
    
#import <DateTools/DateTools.h>
#import "CAnAlgSleep+Desc.h"
#import "ConfigModel.h"
@implementation CAnAlgSleep (Desc)
-(NSString *)wholeDesc
{

    NSMutableString *infoString = [NSMutableString new];

    NSDate *date = [NSDate dateWithTimeIntervalSince1970:self.timeStamp];
    
//    [infoString appendFormat:@"Data record Date:%@, ", [date formattedDateWithStyle:NSDateFormatterFullStyle]];
    [infoString appendFormat:@"Data record Date:%@, ", [date formattedDateWithFormat:_L2(L_DATE_FMT)]];

    // kCFDateFormatterShortStyle
//    @property(strong, nonatomic, readonly)NSNumber *dataUuid;
    [infoString appendFormat:@"UUid:%@, ", self.dataUuid];

//    @property(assign, nonatomic, readonly)NSUInteger sleepDataTimeStamp; // 睡眠的时间戳
    [infoString appendFormat:@"Sleep Date:%@, ", [[NSDate dateWithTimeIntervalSince1970:self.sleepDataTimeStamp] formattedDateWithFormat:_L2(L_DATE_FMT)]];

    
    [infoString appendFormat:@"Sleep state change:%@, ", self.sleepSateDesc];

//    @property(assign, nonatomic, readonly)uint16_t onBedDuration; //卧床时间
    [infoString appendFormat:@"On bed duration:%u minute, ", self.onBedDuration];

//    @property(assign, nonatomic, readonly)uint8_t wakeIndex; // 苏醒次序
    [infoString appendFormat:@"WakeIndex:%u, ", self.wakeIndex];


    
    return infoString;
    
}

-(NSString *)sleepSateDesc {
    NSString *str = @"";
    switch (self.state) {
      
        case  NALG_SLEEP_STATE_ASLEEP : // 苏醒->睡眠
        {
            str = @"Wake up -> Sleep";
        }
            break;
        case  NALG_SLEEP_STATE_WAKE : //  睡眠->苏醒
        {
            str = @"Sleep -> Wake up";
        }
            break;
        default:
            break;
    }
    return str;
    
}

@end
